using System;
using Data;
using EasyGameTemplate;
using Framework.Timer;
using Framework.UI;
using UnityEngine;
using UnityEngine.UI;

public class CubeHud : GamePoolAbstract
{

        public Button LeftButton;
        public Button RightButton;
        public Button ClearButton;

        public GameLightCube Cube;
        private void Start()
        {
                this.LeftButton.onClick.AddListener(this.LeftRotate);
                this.RightButton.onClick.AddListener(this.RightRotate);
                this.ClearButton.onClick.AddListener(this.ClearCube);
        }

        public override void Pool_Disable()
        {
                GameUpdateMgr.Instance.RemoveUpdater(this.DoUpdate);
                base.Pool_Disable();
        }

        public override void Pool_Enable()
        {
                base.Pool_Enable();
                GameUpdateMgr.Instance.AddUpdater(this.DoUpdate);
        }

        private void DoUpdate()
        {
                this.transform.LookAt(GameManager.Instance.MainCamera.transform);
        }

        private void ClearCube()
        {
                UIManager.Instance.EventManager.SendEvent(EventCode.DestroyCube);
        }

        private void RightRotate()
        {
                UIManager.Instance.EventManager.SendEvent(EventCode.RotateCube , true);
        }

        private void LeftRotate()
        {
                UIManager.Instance.EventManager.SendEvent(EventCode.RotateCube , false);
        }



}